package com.gmrz.webauthn.protocol.v1.schema;

public enum HashAlgorithmIdentifier {
    S256("SHA-256");

    private String hashAlgo;

    HashAlgorithmIdentifier(String hashAlgo) {
        this.hashAlgo = hashAlgo;
    }

    public String getHashAlgo() {
        return this.hashAlgo;
    }

    public void setHashAlgo(String hashAlgo) {
        this.hashAlgo = hashAlgo;
    }

    public static HashAlgorithmIdentifier forName(String alg) {
        for (HashAlgorithmIdentifier hashAlgo : values()) {
            if (hashAlgo.getHashAlgo().equalsIgnoreCase(alg)) {
                return hashAlgo;
            }
        }
        throw new IllegalArgumentException("Invalid hash algorithm identifier: " + alg);
    }
}
